import React from 'react'
import { getTimeFromDate } from '../../utils/formatTime'
import style from './style.module.scss'
import { useNavigate } from 'react-router-dom'
import url1 from '../../assets/images/image/hdpi/h_currency.png'
interface pathienList{
  item:pathienCircleHomeList
}
interface pathienCircleHomeList {
  sickCircleId: number,
  userId?: number,
  title: string,
  detail: string,
  releaseTime: number,
  amount: number
}
export const MypathienList:React.FC<pathienList>=({item})=> {
  const navigate=useNavigate()
  return (
    <div className={style.listItem} onClick={() => {
      // 点击跳转病友圈详情页
      navigate(`/patient/circle/detail?id=${item.userId}&sickCircleId=${item.sickCircleId}`)
    }}>
      <div className={style.title}>
        <h3>{item.title}</h3>
        {
          item.amount>0&&<div className={style.HB}><img src={url1} alt="" /><span>{item.amount}</span></div>
        }
      </div>
      <p className={style.time}>{getTimeFromDate(item.releaseTime)}</p>
      <div className={style.detail}>{item.detail}</div>
    </div>
  )
}